package io.jee.caisan.weixin.service.impl;

import java.util.Calendar;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import io.jee.caisan.weixin.domain.Log;
import io.jee.caisan.weixin.repository.LogRepository;
import io.jee.caisan.weixin.service.LogService;

@Service
@Transactional
public class LogServiceImpl implements LogService{
	
	@Resource
	private LogRepository logRepository;

	@Override
	public void addSystem(String content) {
		Log log = new Log();
		log.setType(Log.TYPE_SYSTEM);
		log.setContent(content);
		log.setCreateTime(Calendar.getInstance().getTime());
		logRepository.save(log);
	}

	@Override
	public void addOperate(String content, Integer createId, String creater) {
		Log log = new Log();
		log.setType(Log.TYPE_OPERATE);
		log.setContent(content);
		log.setCreateId(createId);
		log.setCreater(creater);
		log.setCreateTime(Calendar.getInstance().getTime());
		logRepository.save(log);
	}

}
